<?php require_once 'header.php';?>    
<!-- DataTables Responsive CSS -->
    <link href="sb2/vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet">

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                        <?php echo XXF_BACK?>
                            收费情况<a href="fxy_set"><i class="fa fa-fw fa-gear"></i></a>：<span class="xxf_red"><?php echo $result['puname']?></span>
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                        <?php 
                            $xnvar=$result['ptype'].(xdb::getInstance()->getvar("select xinfuxun from peixunban where id=".$result['pid']));
                            $xv=xdb::getInstance()->getvar("select xv from xknv where xn like '".$xnvar."' and xt like 'xinfuxun'");
                        ?>
                            该生培训项目为<span class="xxf_red">{{$xnvar}}({{$xv}})</span>，
                            意向住宿床位等级为
                            <select id="chuangfei">
                            	<?php 
                            	foreach (xdb::getInstance()->getarray("select * from xknv where xt like 'fangjian' order by id desc") as $row){
                            	?>
                            		<option value="<?php echo $row['xv']?>" <?php echo ($result['flevel']==$row['xn'])?"selected":"" ?>><?php echo $row['xn']?></option>			
                            	<?php }?>
                            </select>
                            <input type="hidden" id="flevel" name="x" value="<?php echo $result['flevel']?>">
                            <input type="hidden" id="ftime" name="x" value="<?php echo date("Y-m-d")?>">
                            <input type="hidden" id="f1"  value="{{$xv}}">
                            预计应收费用<u><span id="yfei" class="xxf_red"></span></u>，
                            实收<input type="text" id="xuefei" name="x" value="<?php echo $result['xuefei']?>" style="width:60px;">
                            <select id="qianfei" name="x">
                            	<option <?php echo ('不欠费'==$result['qianfei'])?"selected":"" ?>>不欠费</option>
                            	<option <?php echo (('欠费'==$result['qianfei'])&&($result['xuefei']>0))?"selected":"" ?>>欠费</option><!-- 财务要求改默认为不欠费 -->
                            </select>
                            备注<input type="text" id="fbeizhu" name="x">
                            <input type="button" value="确认" onclick="add()">
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
             </div>
        </div>
        <!-- /#page-wrapper -->
  </div>
        <!-- DataTables JavaScript -->
<?php require_once 'bottom.php';?>
    <script src="sb2/vendor/datatables/js/jquery.dataTables.js"></script>
    <script src="sb2/vendor/datatables-plugins/dataTables.bootstrap.min.js"></script>
    <script src="sb2/vendor/datatables-responsive/dataTables.responsive.js"></script>
    <script>
    $(document).ready(function() {
        yshou();
        $("#chuangfei").change(function(){yshou();});
        $("#yfei").click(function(){$("#xuefei").val($(this).text());});
    });
    function yshou(){////////////////
        $("#yfei").html(parseFloat($("#f1").val())+parseFloat($("#chuangfei").val())*6);
        var cf=$("#chuangfei")[0];
        $("#flevel").val((cf[cf.selectedIndex].label));
    ;}
    
    function add(){
        if(isNaN(parseFloat($("#xuefei").val()))){
        	$.xalert("信息不正确！");return false;
        }
    	$.xconfirm("确定添加？",function(data){
 			if(data){
				$.xloading(1);
				$.xtodb("upd","peixunxueyuan",$("[name='x']"),"<?php echo $result['id']?>",function(data1){
					if(data1==0){
						$.xloading(0);
						$.xalert("添加失败");
					}else{
						alert("处理成功！");
						history.go(-1);
					}
				}); 
			} 
		});
    }    
    </script>